package io.PrintStream;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;

public class printStream {
    public static void main(String[] args) throws IOException {
        PrintStream printWriter = System.out;
        printWriter.print("dadafa");
        printWriter.write("sfjosk".getBytes());
        System.setOut(new PrintStream("d:/Test/create1.txt", "UTF-8"));

        //字符打印流
        PrintWriter printWriter1 = new PrintWriter(System.out);
        printWriter1.print("dafa");
        PrintWriter writer = new PrintWriter(new FileWriter("d:/Test/create1.txt"));
        writer.print("dada");//输出到文件

    }
}
